#提取字符串中所有数字并求和
def get_sum(str1):
    lst=[]
    s=0
    for i in str:
        if i.isdigit():
          lst.append(int(i))
    s=sum(lst)
    return s
str=input("请输入一段字符串：")
num=get_sum(str)
print(num)

#字符串中大写变小写，小写变大写

def lower_upper(x):
    lst = []
    for i in x:
        if "A"<=i<="Z":
            lst.append(chr(ord(i)+32))
        elif "a"<=i<="z":
            lst.append(chr(ord(i)-32))
        else:
            lst.append(i)
    return "".join(lst)
str1=input("请输入字符串:")
NEW_str1=lower_upper(str1)
print(NEW_str1)


